package com.platform.api;

import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.AllArgsConstructor;
import lombok.Builder;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;

/**
 * Request基类
 */
@AllArgsConstructor
@Builder
public class Request<T> extends BaseDto {

    /**
     * 分页数据
     */
    @JsonInclude(value= JsonInclude.Include.NON_NULL)
    private Page page;

    /**
     * 数据承载字段
     */
    @Valid
    @NotNull(message = "data must not be empty")
    private T data;

    public Request(){}

    public Request(T t) {
        this.data = t;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public Page getPage() {
        return page;
    }

    public void setPage(Page page) {
        this.page = page;
    }

}
